<%@page language="java" contentType="text/html;"%>
<%@page import="pkg.Products" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Insert title here</title>
</head>
<body>
<html:form method="get" action="/customer_home">
<c:if test="${empty param.submit }">
<sql:query var="productType" dataSource="jdbc/myoracle">
Select pid,description, cost from productDetails where cost>${sessionScope.customer.products[param.opt].cost} and product_type='${sessionScope.customer.products[param.opt].product_type}'

</sql:query>
<c:if test="${not empty productType.rows }">
${sessionScope.customer.products[param.opt].product_type}

 <form method="get" >
 <c:set value="${param.opt}" var="oldPid" scope="session"></c:set>
<table>
<tr><td/><td>Product ID</td><td>Description</td><td>Cost</td></tr>
<c:forEach items="${productType.rows}" var="row">
<tr>
<td><input type="radio" name="newPid" value="${row.pid}"/></td><td>${row.pid}</td><td>${row.description}</td><td>${row.cost}</td>
</tr>
</c:forEach>
</table>
<input type="submit" name="submit" value="Submit Query"/>
</form>
</c:if>
</c:if>
<c:if test="${empty productType.rows && empty param.submit}">
No upgrade available
</c:if>
<c:if test="${not empty param.submit}">
<%((Products)session.getAttribute("customer")).replaceProducts((String)session.getAttribute("oldPid"),(String)request.getParameter("newPid"));  %>
Updated

<input name="submit" type="submit" value="click here to go back to home page">

</c:if>
</html:form>
</body>
</html>